package com.deyinet.bdcms.entity;

import javax.persistence.*;
import java.sql.Timestamp;

/**
 * Created by Administrator on 2017/8/30 0030.
 */
@Entity
public class Sysmodule {
    private Integer id;
    private String linkurl;
    private Timestamp createdate;
    private String name;
    private Integer parentid;
    private Sysmodule sysmoduleByParentid;
    private String navtabid;
    private Integer ischeck;
    private String title;

    @Id
    @Column(name = "id", nullable = false)
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    @Basic
    @Column(name = "linkurl", nullable = true, length = 100)
    public String getLinkurl() {
        return linkurl;
    }

    public void setLinkurl(String linkurl) {
        this.linkurl = linkurl;
    }

    @Basic
    @Column(name = "createdate", nullable = true)
    public Timestamp getCreatedate() {
        return createdate;
    }

    public void setCreatedate(Timestamp createdate) {
        this.createdate = createdate;
    }
    @Basic
    @Column(name = "parentid",insertable = false,updatable = false)
    public Integer getParentid() {
        return parentid;
    }

    public void setParentid(Integer parentid) {
        this.parentid = parentid;
    }

    @Basic
    @Column(name = "modulename", nullable = true, length = 50)
    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        Sysmodule sysmodule = (Sysmodule) o;

        if (id != sysmodule.id) return false;
        if (linkurl != null ? !linkurl.equals(sysmodule.linkurl) : sysmodule.linkurl != null) return false;
        if (createdate != null ? !createdate.equals(sysmodule.createdate) : sysmodule.createdate != null) return false;
        if (name != null ? !name.equals(sysmodule.name) : sysmodule.name != null) return false;

        return true;
    }

    @Override
    public int hashCode() {
        int result = id;
        result = 31 * result + (linkurl != null ? linkurl.hashCode() : 0);
        result = 31 * result + (createdate != null ? createdate.hashCode() : 0);
        result = 31 * result + (name != null ? name.hashCode() : 0);
        return result;
    }

    @ManyToOne
    @JoinColumn(name = "parentid", referencedColumnName = "id", foreignKey = @ForeignKey(name = "sysmodule_ibfk_1"))
    public Sysmodule getSysmoduleByParentid() {
        return sysmoduleByParentid;
    }

    public void setSysmoduleByParentid(Sysmodule sysmoduleByParentid) {
        this.sysmoduleByParentid = sysmoduleByParentid;
    }

    @Column(name = "navtabid")
    public String getNavtabid() {
        return navtabid;
    }

    public void setNavtabid(String navtabid) {
        this.navtabid = navtabid;
    }


    @Transient
    public Integer getIscheck() {
        return ischeck;
    }

    public void setIscheck(Integer ischeck) {
        this.ischeck = ischeck;
    }

    @Column(name = "title")
    public String getTitle() {
        return title;
    }

    public void setTitle(String title) {
        this.title = title;
    }
}
